package com.xingkeduo.business.user.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.server.reactive.ServerHttpRequest;
import org.springframework.web.bind.annotation.*;

import com.xingkeduo.business.transformation.json.JobseekerJTO;
import com.xingkeduo.business.user.domain.AssessmentDomain;
import com.xingkeduo.util.pojo.base.BaseController;
import com.xingkeduo.util.tool.ReturnUtil;

/**
 * 求职者状态
 * 
 * @author 高杰
 * @time 2019年1月2日 下午4:11:04
 * @description
 */
@RestController
@RequestMapping("/jobseeker/status")
public class JobseekerStatusController extends BaseController {
	@Autowired
	private AssessmentDomain assessmentDomain;

	/**
	 * 求职者修改状态接口
	 * 
	 * @author 高杰
	 * @time 2019年1月2日 下午4:12:33
	 * @param body
	 * @return
	 */
	@PutMapping(value = "/{url:.+}")
	public String doGet(@PathVariable String url, @RequestBody(required = false) String body, ServerHttpRequest request) {
		returnUtil = new ReturnUtil();
		try {
			assessmentDomain.reset(
					JobseekerJTO.createTableForReset(body).setId(JobseekerJTO.createQueryForPrimary(url).getId()),
					getOperator(request));
			return returnUtil.getSuccess();
		} catch (Throwable t) {
			return dealException(t, returnUtil);
		}
	}
}
